package com.java.oop;

public class Student {
    //属性
    private String name;
    private int age;
    private String gender;

    public Student(){
        System.out.println("无参的构造方法");
    }

    public Student(String name,int age,String gender){
        this.name = name;
        this.age = age;
        this.gender = gender;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        if(age >= 18 && age <= 40){
            this.age = age;
        }else {
            System.out.println("你的年龄不符合学生要求");
        }

    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    public void sayHi(){
        System.out.println("我是；"+name+"年龄："+age+"性别："+gender);
    }

}
